# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=babeltrace
pkgver=2.0.4
pkgrel=1
pkgdesc="Trace converter and read/write library"
url="https://www.efficios.com/babeltrace"
arch="all"
license="MIT"
depends_dev="glib-dev"
makedepends="$depends_dev python3-dev swig"
checkdepends="bash grep"  # test cases use both Bash and grep tools
subpackages="$pkgname-dev $pkgname-doc py3-babeltrace:py3bindings"
source="https://www.efficios.com/files/babeltrace/babeltrace2-$pkgver.tar.bz2"
builddir="$srcdir/babeltrace2-$pkgver"

build() {
	# This package uses _init functions to initialise extensions. With
	# --as-needed this will not work.
	export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
	PYTHON_CONFIG=python3-config ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--disable-debug-info \
		--enable-python-bindings \
		--enable-python-plugins
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

py3bindings() {
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib
}

sha512sums="56c827497cf241b183ba03a1d960143894901f5f49836a9494126a1a6e5007202fd57277784f64ba3ab15af7e532cfecc32917ebb7736fecca53033f000b0155  babeltrace2-2.0.4.tar.bz2"
